package com.fancy.learncenter.ui.adapter;

import android.content.Context;
import android.view.View;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.CartoonMediaBean;
import com.fancy.learncenter.common.JumpIntentKey;
import com.fancy.learncenter.ui.adapter.base.CommonRecycleViewAdapter;
import com.fancy.learncenter.ui.adapter.base.CustomViewHold;
import com.fancy.learncenter.ui.callback.AlbumImpl;

import java.util.List;

/**
 * Created by shiweiwei on 2018/1/30.
 */

public class CartoonTeacherQuestionImageAdapter extends CommonRecycleViewAdapter<CartoonMediaBean> {


    JumpIntentKey.QUESTION_ENTER_TYPE type;

    public CartoonTeacherQuestionImageAdapter(Context mContext, JumpIntentKey.QUESTION_ENTER_TYPE type, List<CartoonMediaBean> itemDatas) {
        super(mContext, R.layout.cartoon_teacher_question_image_item, itemDatas);
        this.type = type;
    }


    @Override
    public void bindView(final CustomViewHold customViewHold, CartoonMediaBean item, final int position) {

        final SimpleDraweeView simpleDraweeView = customViewHold.getView(R.id.simpleDraweeView);
        simpleDraweeView.setImageURI(item.getImgUrl());
        final View framLayout = customViewHold.getView(R.id.frame_layout);

        switch (type) {
            case DO_IT_AGAIN:
            case DO_WORK:
            case CONTINUE_WORK:
            case ERROR_KINDS:
                customViewHold.getRoorView().setEnabled(true);
                break;
            case WORK_REPORT:
                customViewHold.getRoorView().setEnabled(false);
                break;
            case NO_CLICK:
                customViewHold.getRoorView().setEnabled(false);
                break;
        }

        if (item.getStatus() == null) {
            item.setStatus(JumpIntentKey.OPTION_STATUS.STATUS_DEFAULT);
        }


        switch (item.getStatus()) {
            case STATUS_DEFAULT: //默认状态
                framLayout.setVisibility(View.VISIBLE);
                framLayout.setBackgroundResource(R.mipmap.cartoon_image_choose);
                break;
            case STATUS_RIGHT: //正确
                framLayout.setVisibility(View.VISIBLE);
                framLayout.setBackgroundResource(R.mipmap.cartoon_image_right);
                break;
            case STATUS_WRONG: //错误
                framLayout.setVisibility(View.VISIBLE);
                framLayout.setBackgroundResource(R.mipmap.cartoon_image_wrong);
                break;
        }


    }
}
